<!DOCTYPE html>
<html>
<head>
	<title>用户注册界面</title>
</head>
<body>
<center>
	<form action="{url:/exam/add_do}" method="post">
	<table>
		<tr>
			<td>用户名:</td>
			<td><input type="text" name="name" id="name" placeholder="请输入用户名"></td>
		</tr>
		<tr>
			<td>密码:</td>
			<td><input type="password" name="pwd" id="pwd" placeholder="请输入密码"></td>
		</tr>
		<tr>
			<td>邮箱:</td>
			<td><input type="text" name="email" id="email" placeholder="请输入邮箱"></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="button" name="" id="but" value="注册"></td>
		</tr>
	</table>
	</form>
</center>
</body>
</html>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
	$("#but").click(function(){
		var name = $("#name").val();
		var pwd = $("#pwd").val();
		var email = $("#email").val();

		if (name==''||pwd==''||email=='') {
			alert("输入内容不能为空");
			return false;
		}
		var filter = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
		if (!filter.test(email)) {
			alert("您的电子邮箱格式不正确");
			return false;
		}
			$("form").submit();
		// $.ajax({
		// 	url:"{url:/exam/add_do}",
		// 	data:{name:name,pwd:pwd,email:email},
		// 	type:"post",
		// 	dataType:"json",
		// 	success:function(e){
		// 		console.log(e);
		// 	}
		// });
	})
</script>